﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels.Http;

using RemotingInterface;

namespace RemotingServer
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting server ...");
            ConfigureInline();
            //ConfigureFile();
            Console.WriteLine("Configuration Done");



            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }

        private static void ConfigureInline()
        {
            HttpChannel myChannel = new HttpChannel(25701);
            ChannelServices.RegisterChannel(myChannel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyServer),
                                                               "MyServer.asmx",
                                                               WellKnownObjectMode.SingleCall);

        }

        private static void ConfigureFile()
        {
            RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

        }

    }
}
